<?php

include '../../db.php';
$connect = pg_connect($connectionString);
if (!$connect) {
    echo "connect : A connection to the server could not be established!";
    return false;
}


$queryString = " SELECT id, price FROM warehouse_product ";


$query = pg_query($connect, $queryString);
if (!$query) {
    echo 'query : ';
    return false;
}
$arrRegistros = pg_fetch_all($query);
foreach ($arrRegistros as $value) {
   echo $value['id']." ". $value['price']."<br>"  ;
   $query = pg_query($connect, "UPDATE warehouse_product SET aux=".$value['price']." WHERE id=".$value['id']);
}
echo json_encode($arrRegistros);
$num_fields = pg_num_fields($query);
$num_rows = pg_num_rows($query);

pg_close($connect);
